import request from '@/router/axios';

export const getList = (current, size, serviceKind, params) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      serviceKind
    }
  })
}

export const getDetail = (params) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/detail',
    method: 'get',
    params: {
      ...params
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

/* 基本信息 新增/修改 */
export const add = (row) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/submit',
    method: 'post',
    data: row
  })
}

/* 服务商个人 基本信息/认证和结算卡详情 */
export const getInfoDetail = (userNo) => {
  return request({
    url: '/api/rb-oem/oem/authExamine/auth_examine/info',
    method: 'get',
    params: {
      userNo
    }
  })
}

/* 实名信息 新增/修改/详情 */
export const authAdd = (row) => {
  return request({
    url: '/api/rb-oem/oem/authExamine/auth_examine/submit',
    method: 'post',
    data: row
  })
}

export const authUpdate = (row) => {
  return request({
    url: '/api/rb-oem/oem/authExamine/auth_examine/submit',
    method: 'post',
    data: row
  })
}
export const authUpdateV2 = (row) => {
  return request({
    url: '/api/rb-oem/oem/authExamine/auth_examine/submitV2',
    method: 'post',
    data: row
  })
}


export const getAuthDetail = (userNo, id) => {
  return request({
    url: '/api/rb-oem/oem/authExamine/auth_examine/detail',
    method: 'get',
    params: {
      userNo,
      id
    }
  })
}

/* 结算卡信息 新增/修改/详情 123*/
export const bankAdd = (row) => {
  return request({
    url: '/api/rb-oem/oem/bankExamine/bank_examine/submit',
    method: 'post',
    data: row
  })
}

export const bankUpdate = (row) => {
  return request({
    url: '/api/rb-oem/oem/bankExamine/bank_examine/submit',
    method: 'post',
    data: row
  })
}

export const getBankDetail = (userNo, id) => {
  return request({
    url: '/api/rb-oem/oem/bankExamine/bank_examine/detail',
    method: 'get',
    params: {
      userNo,
      id
    }
  })
}

/* 支付通道信息 新增/修改/列表/已分配 */
export const aisleAdd = (row) => {
  return request({
    url: '/api/rb-oem/oem/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

export const aisleUpdate = (row) => {
  return request({
    url: '/api/rb-oem/oem/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

export const getAisleOemList = (current, size, userNo) => {
  return request({
    url: '/api/rb-oem/oem/aisleOem/aisle_oem/list',
    method: 'get',
    params: {
      userNo,
      current,
      size,
    }
  })
}

/* 政策分润配置信息 新增/修改 */
export const policyAdd = (row) => {
  return request({
    url: '/api/rb-oem/oem/oempolicy/oem_policy/addPolicy',
    method: 'post',
    data: row
  })
}

export const policyUpdate = (row) => {
  return request({
    url: '/api/rb-oem/oem/oempolicy/oem_policy/addPolicyV3',
    method: 'post',
    data: row
  })
}

export const policyUpdateAll = (row) => {
  return request({
    // url: '/api/rb-oem/oem/aisleOem/aisle_oem/submitPolicy',
    url: '/api/rb-oem/oem/oempolicy/oem_policy/addPolicyV2',
    method: 'post',
    data: row
  })
}

/* 模板政策一键填入赋值 */
export const templatePolicyDetail = (polNo, userNo, userType, id, aisleCode) => {
  return request({
    url: '/api/rb-oem/oem/oempolicy/oem_policy/templateDetail',
    method: 'get',
    params: {
      polNo,
      userNo,
      userType,
      id,
      aisleCode
    }
  })
}

/* 通道政策详情 上级政策 */
export const getPolicyDetail = (userNo, userType, aisleCode) => {
  return request({
    url: '/api/rb-oem/oem/oempolicy/oem_policy/policyDetail',
    method: 'get',
    params: {
      userNo,
      userType,
      aisleCode
    }
  })
}

/* 通道政策详情 服务商政策 */
export const servicePolicyDetail = (row) => {
  return request({
    // url: '/api/rb-oem/oem/oempolicy/oem_policy/servicePolicyDetail',
    url: '/api/rb-oem/oem/oempolicy/oem_policy/servicePolicyDetailV2',
    method: 'POST',
    data: row
  })
}

/* 完成项 走审批 */
export const getFinish = (userNo) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/finish',
    method: 'post',
    params: {
      userNo
    }
  })
}

/* 服务商 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/serviceInfo/service_info/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 服务商 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/serviceInfo/service_info/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 发送短信修改密码 */
export const getUpdatePwdBySms = (userNo) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/updatePwdBySms',
    method: 'get',
    params: {
      userNo
    }
  })
}

/* 直接修改密码 */
export const getUpdatePwd = (userNo, pwd) => {
  return request({
    url: '/api/rb-oem/oem/serviceInfo/service_info/updatePwd',
    method: 'post',
    params: {
      userNo,
      pwd
    }
  })
}

/* 云闪付费率 */
export const getThirdStepAttach = (id) => {
  return request({
    url: '/api/rb-oem/oem/incoming/incoming/thirdStepAttach',
    method: 'get',
    params: {
      id
    }
  })
}

/* 云闪付费率 */
export const getThirdStepAttachPlus = (id) => {
  return request({
    url: '/api/rb-oem/oem/incomingbasic/incoming_basic/thirdStepAttach',
    method: 'get',
    params: {
      id
    }
  })
}